Skip to content

Reject empty path arguments - #771

Open
AbhinavMir wants to merge 1 commit into
containers:mainfrom
AbhinavMir:reject-empty-path-arguments
Open

Reject empty path arguments#771
AbhinavMir wants to merge 1 commit into
containers:mainfrom
AbhinavMir:reject-empty-path-arguments

Conversation

@AbhinavMir

Copy link
Copy Markdown

@smcv smcv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The security fixes in 0.12.0 seem to have mostly addressed this as a side-effect. Is this still necessary?

@smcv smcv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a Signed-off-by to your commit(s) to indicate that the Developer Certificate of Origin can be applied to your contribution.

See https://github.com/containers/common/blob/main/CONTRIBUTING.md for details.

(@alexlarsson, @cgwalters: we should probably add a CONTRIBUTING.md to this project too, even if it's just a cross-reference to that one)

Path arguments become real filenames by concatenation onto "/oldroot/"
or "/newroot/", so an empty path turns into the root directory.

`--bind-try "" DEST` therefore gave the sandbox read/write access to the
whole filesystem, and an empty destination replaced the sandbox root in
the same way. The variants without `-try` failed earlier, because
realpath() rejects an empty source, but the other options that take a
path had no check at all.

Check every path argument during option parsing, and report an empty one
as a usage error.

Signed-off-by: abhinavmir <atg271@gmail.com>
@AbhinavMir
AbhinavMir force-pushed the reject-empty-path-arguments branch from 4310388 to 9fb7980 Compare August 26, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants